package com.allan.wiki_project.controller;

import com.allan.wiki_project.domain.Demo;
import com.allan.wiki_project.service.DemoService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


@RestController //ResponseBody + Controller
//@Controller   返回的是页面 上面返回是字符串
@RequestMapping("/demo")
public class DemoController {
    @Resource
    private DemoService demoService;

    @RequestMapping("/list")
    public List<Demo> list(){
        return demoService.list();
    }

    @RequestMapping("/getById")
    public Demo getById(){
        return demoService.selectById(1L);
    }
}
